package net.easyjava.base.utils.http.juhe;

import com.alibaba.fastjson.JSONObject;
import net.easyjava.base.utils.http.juhe.bean.ResultBean;
import net.easyjava.tools.http.HttpTools;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * Created by wxnacy on 16/1/30.
 */
public class JuheApiUtils {
    private static Logger logger = LoggerFactory.getLogger(JuheApiUtils.class);

    /**
     * 获取result
     * @param url
     * @return
     */
    public static ResultBean getResult(String url){
        try {
            String data = HttpTools.get(url);
            ResultBean resultBean = JSONObject.parseObject(data,ResultBean.class);
            return resultBean;
        } catch (IOException e) {
            logger.error(e.getMessage(),e.fillInStackTrace());
            return null;
        }
    }
}
